package com.icss.library.controller;

import com.icss.library.exception.BizException;
import com.icss.library.pojo.Book;
import com.icss.library.service.BookService;
import org.apache.ibatis.jdbc.SQL;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

import java.sql.SQLException;
import java.util.List;

@Controller
public class BookController {

    @Autowired
    private BookService bookService;

    public List<Book> list(String bname) {
        return bookService.list(bname);
    }

    public int addBook(Book book) {
        try {
            return bookService.addBook(book);
        } catch (Exception e) {
            //e.printStackTrace();
            System.out.println(e.getMessage());
            return -1;
        }
    }

    public int updateBook(Book book) {
        return bookService.updateBook(book);
    }

    public int delBook(Integer bookId) {
        return bookService.delBook(bookId);
    }

    public void liuChangTest(){
        System.out.println("hasdlfasdf-------------------");
    }

    public void houzdTest(){
        System.out.println("第二次测试提交内容");
    }

}
